Skip to content

Update to raw-window-handle 0.6#967

Merged
mergify[bot] merged 1 commit intomasterfrom
raw-window-handle-0.6
Nov 11, 2025
Merged

Update to raw-window-handle 0.6#967
mergify[bot] merged 1 commit intomasterfrom
raw-window-handle-0.6

Conversation

@psychon
Copy link
Owner

@psychon psychon commented Nov 9, 2025

There has been a breaking API change in raw-window-handle. The traits HasRawDisplayHandle and HasRawWindowHandle have been deprecated in favor of the new HasDisplayHandle and HasWindowHandle traits. Instead of a raw handle, a handle containing a lifetime is handed out via these traits. Internally, we still use the raw API and convert to the new handles.

There has been a breaking API change in raw-window-handle. The traits
HasRawDisplayHandle and HasRawWindowHandle have been deprecated in favor
of the new HasDisplayHandle and HasWindowHandle traits. Instead of a raw
handle, a handle containing a lifetime is handed out via these traits.
Internally, we still use the raw API and convert to the new handles.

Signed-off-by: Uli Schlachter <psychon@znc.in>
handle.connection = self.get_raw_xcb_connection();
fn display_handle(&self) -> Result<DisplayHandle<'_>, HandleError> {
// We do not have/know a screen, but people want this trait implemented anyway. We guess.
let screen = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how correct how correct this is. I believe we should have something like:

struct XCBConnectionAndScreen<T: AsRef<XCBConnection>> {
    connection: T,
    screen: usize,
}


impl<T: AsRef<XCBConnection>> HasDisplayHandle for XCBConnectionAndScreen<T> {
    ...
}

Copy link
Owner Author

@psychon psychon Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I do not know that either. But for this PR: It is as correct as the old implementation. Previously, the screen = 0 was just hidden in a call to XcbDisplayHandle::empty(): https://docs.rs/raw-window-handle/0.5.2/src/raw_window_handle/unix.rs.html#191-196

Edit:

I believe we should have something like:

If you want, I can add a struct like that, but I would do that separately and not together with the version bump.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #772 (comment) a similar question was answered with:

The raw-window-handle spec says that it is up to the consumer of the handle to fill these fields in if they need them.

I'm not quite sure what this refers to... 🤷

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I do not know that either. But for this PR: It is as correct as the old implementation. Previously, the screen = 0 was just hidden in a call to XcbDisplayHandle::empty(): https://docs.rs/raw-window-handle/0.5.2/src/raw_window_handle/unix.rs.html#191-196

Then I guess we can leave this as-is

@mergify mergify bot merged commit b9847ff into master Nov 11, 2025
21 checks passed
@mergify mergify bot deleted the raw-window-handle-0.6 branch November 11, 2025 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants